home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1996-01-17 | 5.6 KB | 213 lines |
- ' ************************************* Commands used:
- ' * * Bank Permanent Bank Name
- ' * Amcaf Examples * Bank Temporary =Bank Name$
- ' * Bank Commands Part 1 V1.0 * Bank To Fast
- ' * Written by Chris Hodges * Bank To Chip
- ' * * Bank Stretch
- ' ************************************* Bank Copy
- '
- Gosub INITSCREEN
- Gosub RESERVEBANKS
- Gosub EXBANKSTRETCH
- Gosub EXBANKTOCHIP
- TEXSCROLL[21]
- Gosub EXBANKTOFAST
- Gosub EXBANKNAME
- TEXSCROLL[20]
- Gosub EXBANKNAMESTR
- Gosub EXBANKPERMANENT
- TEXSCROLL[22]
- Gosub EXBANKTEMPORARY
- Gosub EXBANKCOPY
- TEXSCROLL[23]
- Gosub THEEND
- End
-
- ' Open a cute little screen
- INITSCREEN:
- Screen Open 0,640,256,2,Hires
- Palette 0,$FFF
- Curs Off
- ' Give out a smart title
- Centre "Bank Commands Example Part 1 V1.0" : Print : Print
- Return
-
- ' Some short comments...
- THEEND:
- Print "This is the end of part 1 in banks examples."
- Print "I hope you now understand what these commands do and how you can use them."
- Print
- Print "CU at the next part..."
- KEY
- Return
-
- ' First let's reserve some banks
- RESERVEBANKS:
- Reserve As Work 10,1024 : Rem Reserves a fastmem 1 KB temporary bank
- Reserve As Chip Work 11,2048 : Rem Reserves a chipmem 2 KB temporary bank
- Reserve As Data 12,4096 : Rem Reserves a fastmem 4 KB permanent bank
- Reserve As Chip Data 13,8192 : Rem Reserves a chipmem 8 KB permanent bank
- List Bank
- Print
- Print "These are some banks created using 'Reserve As...'"
- Print
- KEY
- Return
-
- ' Command: Bank Stretch
- EXBANKSTRETCH:
- Print "Now let's alter one bank... I think bank 10 is not large enough for my usage"
- Print "so I enlarge it using 'Bank Stretch' to my benefits."
- Print
- KEY
- ' Note the synopsis: Bank Stretch BANK To NEWSIZE
- Extension_8_0244 10 To 10240
- List Bank
- Print
- Print "Compare... and note that the address has changed!"
- Print "The new size may be also smaller, having the same effect as 'Bank Shrink'."
- Print
- KEY
- Return
-
- ' Command: Bank To Chip
- EXBANKTOCHIP:
- Print "I decide to put bank 12 into chipmem, because it's holding some kind of sound."
- Print "So I use 'Bank To Chip' to move it into chipmem."
- Print
- KEY
- ' Note the synopsis: Bank To Chip BANK
- Extension_8_00A0 12
- List Bank
- Print
- Print "The bank is now in chipmem at address ";Hex$(Start(12),6);"."
- Print
- KEY
- Return
-
- ' Command: Bank To Fast
- EXBANKTOFAST:
- Print "Bank 13 holds another sound, but it is currently not used, so I move it into"
- Print "fastmem to get some more chipmem."
- Print
- KEY
- ' Synopsis same as 'Bank To Chip': Bank To Fast BANK
- Extension_8_00B4 13
- List Bank
- Print
- Print "The bank is now in fastmem."
- Print
- KEY
- Return
-
- ' Command: Bank Name
- EXBANKNAME:
- Print "Don't you think 'Data' sounds a bit boring? What about 'Mr. Data' (TNG rulez!)?"
- Print "I'll try it with bank 12 again using 'Bank Name'."
- Print
- KEY
- ' Note the synopsis: Bank Name BANK,NAME$
- Extension_8_028C 12,"Mr. Data"
- List Bank
- Print
- Print "Look! There he is! :-)"
- Print
- KEY
- Return
-
- ' Function: =Bank Name$
- EXBANKNAMESTR:
- Print "Certainly, you can get the current name of a bank using the function"
- Print "'=Bank Name$'. I'll rename bank 10 and read it out afterwards."
- Print
- KEY
- Extension_8_028C 10,"Megacool"
- List Bank
- Print
- ' Synopsis: NAME$=Bank Name$(BANK)
- Print "The new name of bank 10 is '"; Extension_8_027A(10);"'."
- Print
- KEY
- Return
-
- ' Command: Bank Permanent
- EXBANKPERMANENT:
- Print "'I would never let you go...', I said to bank 11, which is currently"
- Print "a temporary bank and would be erased on the start of the program."
- Print "So what can you do, if you want a temporary bank to become a permantent one?"
- Print "I use 'Bank Permanent' on bank 11 and then call 'Erase Temp'."
- Print
- KEY
- ' Synopsis: Bank Permanent BANK
- Extension_8_0074 11
- Erase Temp
- List Bank
- Print
- Print "Look what happended! Bank 11 stayed, but Bank 10 has been erased (sniff)."
- Print
- KEY
- Return
-
- ' Command: Bank Temporary
- EXBANKTEMPORARY:
- Print "'Bank 13, I'm sorry, but I don't want you to stay in my program. By the"
- Print "next 'Erase Temp' you'll have to go'..."
- Print "And so I use 'Bank Temporary', which does the opposite of 'Bank Permanent'."
- Print
- KEY
- ' Synopsis like 'Bank Permanent': Bank Temporary BANK
- Extension_8_008A 13
- Erase Temp
- List Bank
- Print
- Print "Only two banks left, hu?"
- Print
- KEY
- Return
-
- ' Command: Bank Copy
- EXBANKCOPY:
- Print "Bank 12 seems so alone, let's clone him using 'Bank Copy'!!!"
- Print
- KEY
- ' Synopsis: Bank Copy SOURCEBANK To TARGETBANK
- ' Bank Copy STARTADDRESS,ENDADDRESS To TARGETBANK
- Extension_8_025A 12 To 10
- List Bank
- Print
- Print "Look! Now we've got another Mr. Data in bank 10!"
- Print
- KEY
- Return
-
- ' This is to move some text upwards
- Procedure TEXSCROLL[LINES]
- ' Get old cursor position
- Y=Y Curs
- ' Set up scrollzone
- Def Scroll 1,0,18 To 640,248,0,-2
- ' Now scroll this zone up serveral times
- For A=1 To LINES*4
- ' Syncronize, but be system friendly
- Multi Wait
- ' Scroll up
- Scroll 1
- Next
- ' Now move up cursor
- Locate ,Y-LINES
- End Proc
- ' This small procedure waits for an keypress.
- Procedure KEY
- ' Save the cursors original position
- Memorize X : Memorize Y
- ' Prompt some text at the bottom.
- Locate 0,31 : Centre "Press any key to continue."
- ' I do not use 'Wait Key', because it's not multitasking friendly
- Repeat
- Multi Wait
- Until Inkey$<>""
- ' Clear the line
- Cline
- ' Restore the position
- Remember X : Remember Y
- End Proc